<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Index extends PUBLIC_Controller  {
	
	function __construct(){
		parent::__construct();
		$this->load->model("event_model");
		$this->load->model("achieve_model");
		$this->load->model("career_model");
		$this->load->model("scroller_model");
		$this->load->helper('cookie');
		$this->load->library('user_agent');
		$this->load->library("pagination");
		$agent = '';
		if ($this->agent->is_mobile())
		{
			$agent = $this->agent->mobile();
		}
		
		
		
	}
	
	public function index() {
		if (!($this->input->cookie('splash', TRUE))) {
			$this->input->set_cookie('splash', 'splash', 604800);
			redirect('public/index/splash');
		}
		else {
		$this->data["scroller_a"] = $this->scroller_model->achieve();
		$this->data["scroller_e"] = $this->scroller_model->event();
		$this->data["event"] = $this->event_model->show_latest();
		$this->data["agent"] = $this->agent;
		$this->data["achieve"] = $this->achieve_model->show_latest();
		$this->render_page('public_index_view');
		}
	}
	
	public function splash()
	{
		$this->load->view('public_splash');
	}
	
	public function contact() {
		$this->render_page('public_email_send');
	}
	
	public function about_ait() {
		$this->render_page('about_clg');
	}
	
	public function about_aa() {
		$this->render_page('about_ait');
	}
	
	public function job() {
		$config = array();
		$config["base_url"] = base_url() . "index.php/public/index/job";
		$config["total_rows"] = $this->career_model->record_count();
		$config["per_page"] = 15;
		$config["uri_segment"] = 3;
		
		$this->pagination->initialize($config);
		$page = ($this->uri->segment(3)) ? $this->uri->segment(3) : 0;
		$this->data["results"] = $this->career_model->show_all_jobs($config["per_page"], $page);
		
		if($config["total_rows"] > 15)
			$this->data["links"] = $this->pagination->create_links();
		$this->render_page('public_show_job_view');
	}
}

/* End of file index.php */
/* Location: ./application/controllers/public/index.php */